package com.zhentao.controller;

import com.zhentao.model.article.dto.ArticleHomeDto;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.ApArticleContentService;
import com.zhentao.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/article")
public class ApArticleHomeController {
    @Autowired
    private ArticleService articleService;
    @Autowired
    private ApArticleContentService apArticleContentService;
    @PostMapping("/load")
    public ResponseResult load(@RequestBody ArticleHomeDto dto) {
//        0 无图文章
        return articleService.load(0, dto);
    }
    @PostMapping("/loadmore")
    public ResponseResult loadmore(@RequestBody ArticleHomeDto dto){
//        1 单图文章
        return articleService.load(1,dto);
    }
    @PostMapping("/loadnew")
    public ResponseResult loadnew(@RequestBody ArticleHomeDto dto){
//        2 多图文章
        return articleService.load(2,dto);
    }


    @PostMapping("/minio")
    public ResponseResult articelMinio(Long articleId){
        return apArticleContentService.createStaticUrl(articleId);
    }

}
